package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.annotation.Generated;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllStudents", query = "select myStudent from Student myStudent"),
		@NamedQuery(name = "findStudentByCurrentPosition", query = "select myStudent from Student myStudent where myStudent.currentPosition = ?1"),
		@NamedQuery(name = "findStudentByCurrentPositionContaining", query = "select myStudent from Student myStudent where myStudent.currentPosition like ?1"),
		@NamedQuery(name = "findStudentByEmail", query = "select myStudent from Student myStudent where myStudent.email = ?1"),
		@NamedQuery(name = "findStudentByEmailContaining", query = "select myStudent from Student myStudent where myStudent.email like ?1"),
		@NamedQuery(name = "findStudentByFirstName", query = "select myStudent from Student myStudent where myStudent.firstName = ?1"),
		@NamedQuery(name = "findStudentByFirstNameContaining", query = "select myStudent from Student myStudent where myStudent.firstName like ?1"),
		@NamedQuery(name = "findStudentByGraduated", query = "select myStudent from Student myStudent where myStudent.graduated = ?1"),
		@NamedQuery(name = "findStudentByGraduatedContaining", query = "select myStudent from Student myStudent where myStudent.graduated like ?1"),
		@NamedQuery(name = "findStudentByLastName", query = "select myStudent from Student myStudent where myStudent.lastName = ?1"),
		@NamedQuery(name = "findStudentByLastNameContaining", query = "select myStudent from Student myStudent where myStudent.lastName like ?1"),
		@NamedQuery(name = "findStudentByMajor", query = "select myStudent from Student myStudent where myStudent.major = ?1"),
		@NamedQuery(name = "findStudentByMajorContaining", query = "select myStudent from Student myStudent where myStudent.major like ?1"),
		@NamedQuery(name = "findStudentByNnumber", query = "select myStudent from Student myStudent where myStudent.nnumber = ?1"),
		@NamedQuery(name = "findStudentByNnumberContaining", query = "select myStudent from Student myStudent where myStudent.nnumber like ?1"),
		@NamedQuery(name = "findStudentByPrimaryKey", query = "select myStudent from Student myStudent where myStudent.studentId = ?1"),
		@NamedQuery(name = "findStudentByStudentId", query = "select myStudent from Student myStudent where myStudent.studentId = ?1"),
		@NamedQuery(name = "findStudentByYearGraduated", query = "select myStudent from Student myStudent where myStudent.yearGraduated = ?1") })
@Table(catalog = "ThesisManagement", name = "Student")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Student")
@XmlRootElement(namespace = "rms_test/edu/unf/cen6940/domain")
public class Student implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "studentID", nullable = false, insertable = false, updatable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer studentId;
	/**
	 */

	@Column(name = "nNumber", length = 10, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String nnumber;
	/**
	 */

	@Column(name = "firstName", length = 30, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String firstName;
	/**
	 */

	@Column(name = "lastName", length = 45, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String lastName;
	/**
	 */

	@Column(name = "email", length = 50, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String email;
	/**
	 */

	@Column(name = "major", length = 30)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String major;
	/**
	 */

	@Column(name = "graduated", length = 1)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String graduated;
	/**
	 */

	@Column(name = "currentPosition", length = 1024)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String currentPosition;
	/**
	 */

	@Column(name = "yearGraduated")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Integer yearGraduated;

	/**
	 */
	@OneToMany(mappedBy = "student", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Facultyresearchtostudent> facultyresearchtostudents;
	/**
	 */
	@OneToMany(mappedBy = "student", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Thesis> thesises;

	/**
	 */
	public void setStudentId(Integer studentId) {
		this.studentId = studentId;
	}

	/**
	 */
	public Integer getStudentId() {
		return this.studentId;
	}

	/**
	 */
	public void setNnumber(String nnumber) {
		this.nnumber = nnumber;
	}

	/**
	 */
	public String getNnumber() {
		return this.nnumber;
	}

	/**
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 */
	public String getFirstName() {
		return this.firstName;
	}

	/**
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 */
	public String getLastName() {
		return this.lastName;
	}

	/**
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 */
	public String getEmail() {
		return this.email;
	}

	/**
	 */
	public void setMajor(String major) {
		this.major = major;
	}

	/**
	 */
	public String getMajor() {
		return this.major;
	}

	/**
	 */
	public void setGraduated(String graduated) {
		this.graduated = graduated;
	}

	/**
	 */
	public String getGraduated() {
		return this.graduated;
	}

	/**
	 */
	public void setCurrentPosition(String currentPosition) {
		this.currentPosition = currentPosition;
	}

	/**
	 */
	public String getCurrentPosition() {
		return this.currentPosition;
	}

	/**
	 */
	public void setYearGraduated(Integer yearGraduated) {
		this.yearGraduated = yearGraduated;
	}

	/**
	 */
	public Integer getYearGraduated() {
		return this.yearGraduated;
	}

	/**
	 */
	public void setFacultyresearchtostudents(Set<Facultyresearchtostudent> facultyresearchtostudents) {
		this.facultyresearchtostudents = facultyresearchtostudents;
	}

	/**
	 */
	public Set<Facultyresearchtostudent> getFacultyresearchtostudents() {
		if (facultyresearchtostudents == null) {
			facultyresearchtostudents = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearchtostudent>();
		}
		return facultyresearchtostudents;
	}

	/**
	 */
	public void setThesises(Set<Thesis> thesises) {
		this.thesises = thesises;
	}

	/**
	 */
	public Set<Thesis> getThesises() {
		if (thesises == null) {
			thesises = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>();
		}
		return thesises;
	}

	/**
	 */
	public Student() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Student that) {
		setStudentId(that.getStudentId());
		setNnumber(that.getNnumber());
		setFirstName(that.getFirstName());
		setLastName(that.getLastName());
		setEmail(that.getEmail());
		setMajor(that.getMajor());
		setGraduated(that.getGraduated());
		setCurrentPosition(that.getCurrentPosition());
		setYearGraduated(that.getYearGraduated());
		setFacultyresearchtostudents(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearchtostudent>(that.getFacultyresearchtostudents()));
		setThesises(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>(that.getThesises()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("studentId=[").append(studentId).append("] ");
		buffer.append("nnumber=[").append(nnumber).append("] ");
		buffer.append("firstName=[").append(firstName).append("] ");
		buffer.append("lastName=[").append(lastName).append("] ");
		buffer.append("email=[").append(email).append("] ");
		buffer.append("major=[").append(major).append("] ");
		buffer.append("graduated=[").append(graduated).append("] ");
		buffer.append("currentPosition=[").append(currentPosition).append("] ");
		buffer.append("yearGraduated=[").append(yearGraduated).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((studentId == null) ? 0 : studentId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Student))
			return false;
		Student equalCheck = (Student) obj;
		if ((studentId == null && equalCheck.studentId != null) || (studentId != null && equalCheck.studentId == null))
			return false;
		if (studentId != null && !studentId.equals(equalCheck.studentId))
			return false;
		return true;
	}
}
